//{ "allowMappedTypes": "in-unions" }
type Foo1<T> = { readonly [P in keyof T]: T[P] };

type Foo2<T> = { [P in keyof T]?: T[P] };

type Foo5<T> = {
  readonly [P in keyof T]: T[P];
};

